
import axios from '~/axios'

// 课程类别--------------------------
/**
 * 获取课程类别树
 * @param {*} paramIo 
 */
export function api_category_tree() {
    return axios({
        url: '/official/backend/category/tree',
        method: 'get'
    })
}

/**
 * 新增
 * @param {*} paramIo 
 */
export function api_category_add(paramIo) {
    return axios({
        url: '/official/backend/category/add',
        method: 'post',
        data: paramIo
    })
}

/**
 * 修改
 * @param {*} paramIo 
 */
export function api_category_update(paramIo) {
    return axios({
        url: '/official/backend/category/update',
        method: 'post',
        data: paramIo
    })
}

/**
 * 删除
 * @param {*} id 
 */
export function api_category_delete(id) {
    return axios({
        url: '/official/backend/category/delete/'+id,
        method: 'post'
    })
}
// 课程类别--------------------------


// 课程管理--------------------------
/**
 * 列表查询
 * @param {*} paramIo 
 */
export function api_course_list(paramIo) {
    return axios({
        url: '/official/backend/course/list',
        method: 'post',
        data: paramIo
    })
}

/**
 * 根据ID获取课程信息
 * @param {*} paramIo 
 */
export function api_course_getById(id) {
    return axios({
        url: '/official/backend/course/get/'+id,
        method: 'post',
    })
}

/**
 * 新增
 * @param {*} paramIo 
 */
export function api_course_add(paramIo) {
    return axios({
        url: '/official/backend/course/add',
        method: 'post',
        data: paramIo
    })
}

/**
 * 修改
 * @param {*} paramIo 
 */
export function api_course_update(id,paramIo) {
    paramIo.id = id
    return axios({
        url: '/official/backend/course/update',
        method: 'post',
        data: paramIo
    })
}

/**
 * 上架|下架
 * @param {*} paramIo 
 */
export function api_course_changeState(id,state) {
    return axios({
        url: '/official/backend/course/changeState/'+id+"/"+state,
        method: 'post'
    })
}


/**
 * 删除
 * @param {*} paramIo 
 */
export function api_course_delete(id) {
    return axios({
        url: '/official/backend/course/delete/'+id,
        method: 'post'
    })
}


// 课程管理--------------------------


// 课时管理--------------------------
/**
 * 列表查询
 * @param {*} paramIo 
 */
export function api_course_class_list(paramIo) {
    return axios({
        url: '/official/backend/course/class/list',
        method: 'post',
        data: paramIo
    })
}

/**
 * 新增
 * @param {*} paramIo 
 */
export function api_course_class_add(paramIo) {
    return axios({
        url: '/official/backend/course/class/add',
        method: 'post',
        data: paramIo,
        timeout: 3000000
    })
}

/**
 * 修改
 * @param {*} paramIo 
 */
export function api_course_class_update(id,paramIo) {
    paramIo.id = id
    return axios({
        url: '/official/backend/course/class/update',
        method: 'post',
        data: paramIo,
        timeout: 3000000
    })
}

/**
 * 删除
 * @param {*} paramIo 
 */
export function api_course_class_delete(id) {
    return axios({
        url: '/official/backend/course/class/delete/'+ id,
        method: 'post'
    })
}

// 课时管理--------------------------


// 课程附件管理--------------------------

/**
 * 列表查询
 * @param {*} courseId 
 */
export function api_course_file_list(courseId) {
    return axios({
        url: '/official/backend/course/file/list/'+courseId,
        method: 'post'
    })
}

/**
 * 新增
 * @param {*} paramIo 
 */
export function api_course_file_add(paramIo) {
    return axios({
        url: '/official/backend/course/file/add',
        method: 'post',
        data: paramIo,
        timeout: 3000000
    })
}

/**
 * 删除
 * @param {*} id 
 */
export function api_course_file_delete(id) {
    return axios({
        url: '/official/backend/course/file/delete/'+id,
        method: 'post'
    })
}
// 课程附件管理--------------------------